package com.freesky.biz.rights.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.freesky.biz.icbc.domain.TAigouFriday;
import com.freesky.biz.icbc.service.IAigouFridayService;
import com.freesky.biz.rights.domain.RightsBusiEntity;
import com.freesky.biz.rights.domain.RightsReceiveEntity;
import com.freesky.biz.rights.service.IRightsReceiveService;
import com.freesky.common.annotation.Log;
import com.freesky.common.core.controller.BaseController;
import com.freesky.common.core.domain.AjaxResult;
import com.freesky.common.core.page.TableDataInfo;
import com.freesky.common.enums.BusinessType;
import com.freesky.common.utils.QueryWrapperUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("/rights/receive")
public class RightsReceiveController extends BaseController {

    @Autowired
    private IRightsReceiveService rightsReceiveService;

    /**
     * 权益领取记录列表
     */
    @PreAuthorize("@ss.hasPermi('rights:receive:list')")
    @GetMapping("/list")
    public TableDataInfo list(RightsReceiveEntity rightsReceive) {
        IPage<RightsReceiveEntity> pageList = rightsReceiveService.selectReceivePage(plusPage(),rightsReceive);
        return getDataTable(pageList);
    }

    @Log(title = "权益领取记录", businessType = BusinessType.EXPORT)
    @PreAuthorize("@ss.hasPermi('rights:receive:export')")
    @GetMapping("/export")
    public AjaxResult export(RightsReceiveEntity rightsReceive,
                             HttpServletResponse response) {
        return rightsReceiveService.exportFile(rightsReceive);
    }
}
